﻿<%@ Page Language="C#" MasterPageFile="~/Manager.master" AutoEventWireup="true" CodeFile="AddNews.aspx.cs"
    Inherits="Manager_News_AddNews" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
   <script src="<%= ResolveClientUrl("~/")%>Pub/ckeditor/ckeditor.js" type="text/javascript"></script>

    <div align="center">
        <table style="width: 90%" border="1" cellpadding="2" cellspacing="2" class="tbl_Comon-Search">
            <tr>
                <td align="left" class="td_Control" colspan="2">
                    <asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="grpAdd" />
                </td>
            </tr>
            <tr>
                <td class="td_Title" style="width: 131px">
                    Tiêu đề</td>
                <td align="left" class="td_Control">
                    <asp:TextBox ID="txtTheLoai" runat="server" Width="92%" ValidationGroup="grpAdd"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtTheLoai"
                        ErrorMessage="Nhập thể loại" ValidationGroup="grpAdd">*</asp:RequiredFieldValidator></td>
            </tr>
            <tr>
                <td class="td_Title" style="width: 131px">
                    Loại tin tức</td>
                <td align="left" class="td_Control">
                    <asp:DropDownList ID="ddlChuDe" runat="server" ValidationGroup="grpAdd">
                    </asp:DropDownList>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="ddlChuDe"
                        ErrorMessage="Chọn chủ đề" InitialValue="0" ValidationGroup="grpAdd">*</asp:RequiredFieldValidator></td>
            </tr>
            <tr>
                <td class="td_Title" style="width: 131px; height: 15px;">
                    Hình ảnh</td>
                <td align="left" class="td_Control" style="height: 15px">
                    <table border="0" cellpadding="0" cellspacing="0">
                        <tr>
                            <td>
                                <asp:FileUpload ID="FileU_HinhMinhHoa" runat="server" />
                            </td>
                            <td>
                                <img id="imgShowImage" runat="server" height="20" onmouseout="HidePopUpTooltip()"
                                    onmouseover="OpenPopUpTooltip(this)" src="../../Images/Icon/show_image.png" style="cursor: pointer"
                                    visible="false" width="20" />
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td align="center" colspan="2" style="border-bottom-color: #407db3; border-top-color: #407db3;
                    background-color: lightcyan; border-right-color: #407db3">
                                                   <textarea name="FCKeditor1" id="FCKeditor1" runat="server"  style="height:300px;width:95%;"></textarea>

                </td>
            </tr>
            <tr>
                <td class="cssManage_left" colspan="2">
                </td>
            </tr>
            <tr>
                <td style="width: 131px">
                </td>
                <td style="height: 24px" align="left">
                    <asp:Button ID="btnAdd" runat="server" CssClass="cssButton" Text="Bảo lưu" Width="80px"
                        OnClick="btnAdd_Click" ValidationGroup="grpAdd" />
                    <asp:Button ID="btnCancel" runat="server" CssClass="cssButton" Text="Trở về" OnClick="btnCancel_Click"
                        Width="80px" /></td>
            </tr>
        </table>
    </div>
    <input type="hidden" id="hImg" name="hImg" runat="server" />
    <div class='product_popup' id="divTooltip" onmouseover="OpenDivPopUpTooltip()" onmouseout="HidePopUpTooltip(this)"
        style="position: absolute">
        <table border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td colspan="3" nowrap="nowrap" rowspan="2" class="product_detail_popup" id="tdProductDetail"
                    style="text-align: center">
                    <img runat="server" id="imgURL" onclick="HidePopUpTooltip()" />
                </td>
            </tr>
            <tr>
            </tr>
        </table>
    </div>

    <script language="javascript" type="text/javascript">
     CKEDITOR.replace(
    document.getElementById("<%= FCKeditor1.ClientID%>")
    );        

     function OpenPopUpTooltip(obj)
     { 
 
       obj.style.cursor="pointer";
 
       
        var divTooltip=document.getElementById("divTooltip");
        divTooltip.style.visibility="visible" ;
  
        var sleft=ObjectPosition(obj)[0];       
        var stop=ObjectPosition(obj)[1]-(divTooltip.clientHeight/2);    
     
        divTooltip.style.left = sleft + 'px';
        divTooltip.style.top =  stop+ 'px';                

       
       
    }
    function ObjectPosition(obj) 
    {
          var curleft = 0;
          var curtop = 0;
          if (obj.offsetParent) {
                do {
                      curleft += obj.offsetLeft;
                      curtop += obj.offsetTop;
                } while (obj = obj.offsetParent);
          }
          return [curleft,curtop];
	}
	
	
	 function HidePopUpTooltip(obj)
     { 
             var divTooltip=document.getElementById("divTooltip");
             divTooltip.style.visibility="hidden";

             
     }
     
     function OpenDivPopUpTooltip()
     { 
             var divTooltip=document.getElementById("divTooltip");
             divTooltip.style.visibility="visible"
     }
    </script>

</asp:Content>
